#ifndef SERVER_H
#define SERVER_H

#include <string>
#include <boost/asio.hpp>

namespace mms
{

	using boost::asio::ip::tcp;

	class Server
	{

	public:

		Server(const std::string &filename, int port);

		~Server();

		void listen();

		int port() const;

		std::string filename() const;

	private:

		std::string header(int contentLength);

		std::string forbidden_header();

		std::string readRequest(tcp::socket &socket);

		void handle_accept(tcp::socket *socket);

	private:

		int _port;

		std::string _filename;

		boost::asio::io_service _io_service;

		tcp::acceptor *_acceptor;

	};

}

#endif
